{mfdeclre.i}

  DEFINE INPUT PARAMETER src_curr AS CHARACTER .
  DEFINE INPUT PARAMETER tar_curr AS CHARACTER. 
  DEFINE INPUT PARAMETER src_amt AS DECIMAL .
  DEFINE OUTPUT PARAMETER tar_amt AS DECIMAL .

  DEFINE VARIABLE pdate  as date      no-undo.
  DEFINE VARIABLE prate  as decimal   no-undo initial 1.
  DEFINE VARIABLE prate2 as decimal   no-undo initial 1.
  DEFINE VARIABLE perror as integer   no-undo initial 0.

  ASSIGN pdate = TODAY.

    /* CONVERT FROM BASE TO FOREIGN CURRENCY */
  {gprunp.i "mcpl" "p" "mc-get-ex-rate"
            "(input src_curr,
              input tar_curr,
              input """",
              input pdate,
              output prate,
              output prate2,
              output perror)"}.
/*
    if perror <> 0 then do:
      {pxmsg.i &MSGNUM=perror &ERRORLEVEL=2}
    end.
*/    
   ASSIGN tar_amt = src_amt * prate2.


